/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.brain.core.dto;

import com.brain.core.dto.EmpresaDto;
import com.brain.core.dto.UbigeoDto;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

/**
 *
 * @author Ronald
 */
@Entity
@Table(name = "TCORE_EMPRESA_UBIGEO")
public class EmpresaUbigeoDto implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "SEQ_TCORE_EMPRESA_UBIGEO")
    @TableGenerator(name = "SEQ_TCORE_EMPRESA_UBIGEO", table = "TCORE_ENTIDAD", pkColumnName = "NOMBRE", valueColumnName = "CORRELATIVO", pkColumnValue = "TCORE_EMPRESA_UBIGEO", allocationSize = 1)
    private Long id;

    @JoinColumn(name = "EMPRESA", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private EmpresaDto empresaDto;
    @JoinColumn(name = "UBIGEO", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private UbigeoDto ubigeoDto;
    
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public EmpresaDto getEmpresaDto() {
        return empresaDto;
    }

    public void setEmpresaDto(EmpresaDto empresaDto) {
        this.empresaDto = empresaDto;
    }

    public UbigeoDto getUbigeoDto() {
        return ubigeoDto;
    }

    public void setUbigeoDto(UbigeoDto ubigeoDto) {
        this.ubigeoDto = ubigeoDto;
    }
    
    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EmpresaUbigeoDto)) {
            return false;
        }
        EmpresaUbigeoDto other = (EmpresaUbigeoDto) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.brain.core.dto.EmpresaUbigeoDto[ id=" + id + " ]";
    }
    
}
